const path = require('path')
module.exports = function (plop) {
    plop.setGenerator('哇哦', {
        description: '',
        prompts: [
            {
                type: 'input',
                name: 'name',
                message: 'name呵'
            },
            {
                type: 'confirm',
                name: 'confirm',
                message: '确认'
            }
        ],
        actions: data => {
            console.log(14, global.$ws)
            if (global.$ws) {
                global.$ws.send(JSON.stringify({
                    type: '21'
                }))
                // global.$ws.close()
            }

            return [{
                type: 'add',
                path: path.resolve(__dirname, '../file/{{name}}.js'),
                data: {
                    data
                },
                templateFile: path.resolve(__dirname, '../template/controller.hbs')
            }]
        }
    })
}